﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;

namespace Super_Wall_Breaker.Sources.GameElements
{
    /// <summary>
    /// It's sprites which are movable like the ball and the bat among others
    /// </summary>
    public class MovableSprite : Sprite
    {

        private Vector2 _speed;

        /// <summary>
        /// Gets or sets the speed.
        /// </summary>
        /// <value>
        /// The speed.
        /// </value>
        public Vector2 Speed
        {
            get { return _speed; }
            set { _speed = value; }
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="MovableSprite"/> class.
        /// </summary>
        public MovableSprite() { }

        /// <summary>
        /// Initializes a new instance of the <see cref="MovableSprite"/> class.
        /// </summary>
        /// <param name="position">The position of the sprite.</param>
        /// <param name="speed">The speed of the sprite.</param>
        /// <param name="sourceRectangle">The source rectangle.</param>
        public MovableSprite(Vector2 position, Vector2 speed,Rectangle? sourceRectangle)
            : base(position, sourceRectangle)
        {
            this.Speed = speed;
        }

        /// <summary>
        /// Updates the specified game time.
        /// </summary>
        /// <param name="gameTime">The game time.</param>
        public virtual void Update(GameTime gameTime)
        {
            this.Position += this.Speed * (float)gameTime.ElapsedGameTime.TotalMilliseconds;
        }
    }
}
